import { SET_USER_LIST, ADD_USER } from "../action-types";
const initialState = {
  list: [],
};

function user(state = initialState, action) {
  switch (action.type) {
    case SET_USER_LIST:
      return {
        ...state,
       list: action.payload,
      };
      case ADD_USER:
        console.log(state,action,'ADD_USER')
        return {
          ...state,
         list: [...state.list, action.payload],
        };
    default:
      return state;
  }
}

export default user;